
;;experimental

(defun bja-open-line-below ()
(interactive)
(end-of-line)
(open-line 1)
(next-line 1)
(indent-according-to-mode))

(defun bja-open-line-above ()
(interactive)
(beginning-of-line)
(open-line 1)
(indent-according-to-mode))


;;open the shortcuts folder
(defun twin-words ()
  (interactive)
  (find-file (concat *init-home-dir* "documents/twin-words")))
;;bind keys


;;open the shortcuts folder
(defun shortcuts ()
  (interactive)
  (find-file (concat *init-home-dir* "documents/shortcuts")))
;;bind keys

(defun open-todo ()
  (interactive)
  (find-file (concat *init-home-dir* "documents/todo")))



;toggling truncate lines - for line wrapping ....................................................................................................................................................................
(defun truncate-lines-toggle ()
  "Toggle the truncate-lines variable"
  (interactive)
  (set-variable 'truncate-lines (cond
                                 ((eq truncate-lines 't) nil)
                                 (t 't))))
(global-set-key (kbd "<f11>") 'truncate-lines-toggle)



;;pretty printing errors from the anniversary system
(fset 'pretty-print-hassles
   (lambda (&optional arg) "Keyboard macro." (interactive "p") (kmacro-exec-ring-item (quote ([down 40 backspace 134217848 40 98 101 103 105 110 110 backspace backspace backspace backspace backspace backspace backspace 98 101 103 105 110 110 105 110 103 45 111 102 45 108 105 110 101 tab return 67108896 134217747 91 48 45 57 93 13 M-left 23 down 134217848 106 111 105 110 45 105 backspace 105 backspace 108 105 110 tab return 40 98 backspace backspace 134217848 98 101 103 105 110 110 105 110 103 45 111 102 45 108 105 110 tab return] 0 "%d")) arg)))


;changing all tabs to commas - useful for sql type stuff
(fset 'tabs2commas
   (lambda (&optional arg) "Keyboard macro." (interactive "p") (kmacro-exec-ring-item (quote ([134217765 tab return 44 return 33] 0 "%d")) arg)))


;adding select to the front, and union all to the end
(fset 'select-union-all
   (lambda (&optional arg) "Keyboard macro." (interactive "p") (kmacro-exec-ring-item (quote ([1 83 69 76 69 67 84 33554464 5 32 85 78 73 79 78 33554464 65 76 76 down 1] 0 "%d")) arg)))

;matching parens
;; Function definitions.

(defun goto-matching-paren (arg)
  (interactive "p")
  (cond ((or (looking-at "(") (looking-at "{")) (forward-sexp)
(backward-char 1))
	((or (looking-at ")") (looking-at "}")) (forward-char 1) (backward-sexp))))



(global-set-key (kbd "C-5") 'goto-matching-paren)


;(setq macro-sql-query
;   [?\C-  ?\M-x ?e ?n ?d ?- ?o ?f ?- ?l ?i ?n ?e return ?\C-x ?r ?s ?r ?\C-x ?o ?\M-< ?\C-  ?\M-> ?\C-w ?s ?p ?_ ?h ?e ?l ?p ?t ?e ?x ?t ?  ?\C-x ?r ?i ?r ?\M-x ?e ?n ?d ?- ?o ?f ?- ?l ?i ?n ?e return return ?g ?o return ?\M-< ?\C-s ?v ?e ?h ?i ?c ?l ?e ?m ?a ?k ?e ?c ?o ?d ?e ?\C-m])

;(fset 'sp_helptext
;   [?\C-  ?\M-x ?e ?n ?d ?- ?o ?f ?- ?l ?i ?n ?e return ?\C-x ?r ?s ?r ?\C-x ?o ?\M-< ?\C-  ?\M-> ?\C-w ?s ?p ?_ ?h ?e ?l ?p ?t ?e ?x ?t ?  ?\C-x ?r ?i ?r ?\M-x ?e ?n ?d ?- ?o ?f ?- ?l ?i ?n ?e return return ?g ?o return ?\M-< ?\C-s ?v ?e ?h ?i ?c ?l ?e ?m ?a ?k ?e ?c ?o ?d ?e ?\C-m])

